/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef _World_H_
#define _World_H_

#include "Common.h"
#include "Avatar.h"
#include "WaterEffectManager.h"
#include "SkyEffectManager.h"
#include "CameraController.h"
#include "FishManager.h"

namespace Fish3D
{
	class World
		: public OIS::MouseListener, public OIS::KeyListener
	{
	protected:
		World(void);

	public:
		~World(void);
		static World &getSingleton()
		{
			static World world;
			return world;
		}

		void init(Ogre::RenderWindow* win);
		void update(float deltaT);

		void setupViewport();
		void setupScene();
		void setupGUI();
		void setupInputListener();

	protected:
		Ogre::Root *_root;
		Ogre::RenderWindow *_win;
		Ogre::SceneManager *_sceneMgr;
		Ogre::Camera *_camera;

		WaterEffectManager* _waterManager;
		SkyManager* _skyManager;
		FishManager* _fishManager;

		Avatar *_avatar;

		CameraController* _cameraController;
		bool _rightMouseDown;

	protected:
		void setupAvatar();
	protected:
		bool keyPressed( const OIS::KeyEvent &e );
		bool keyReleased( const OIS::KeyEvent &e );

		bool mouseMoved( const OIS::MouseEvent &e );
		bool mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id);
		bool mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id);
	};
}
#endif
